home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / geowindo / sample.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-05-28  |  4.5 KB  |  168 lines

  1. // Sample.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "Sample.h"
  6.  
  7. #include "MainFrm.h"
  8. #include "ChildFrm.h"
  9. #include "SampleDoc.h"
  10. #include "SampleView.h"
  11.  
  12. #include "GeometryManager.h"
  13.  
  14. #ifdef _DEBUG
  15. #define new DEBUG_NEW
  16. #undef THIS_FILE
  17. static char THIS_FILE[] = __FILE__;
  18. #endif
  19.  
  20. /////////////////////////////////////////////////////////////////////////////
  21. // CSampleApp
  22.  
  23. BEGIN_MESSAGE_MAP(CSampleApp, CWinApp)
  24.     //{{AFX_MSG_MAP(CSampleApp)
  25.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  26.         // NOTE - the ClassWizard will add and remove mapping macros here.
  27.         //    DO NOT EDIT what you see in these blocks of generated code!
  28.     //}}AFX_MSG_MAP
  29.     // Standard file based document commands
  30.     ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  31.     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  32. END_MESSAGE_MAP()
  33.  
  34. /////////////////////////////////////////////////////////////////////////////
  35. // CSampleApp construction
  36.  
  37. CSampleApp::CSampleApp()
  38. {
  39.     // TODO: add construction code here,
  40.     // Place all significant initialization in InitInstance
  41. }
  42.  
  43. /////////////////////////////////////////////////////////////////////////////
  44. // The one and only CSampleApp object
  45.  
  46. CSampleApp theApp;
  47.  
  48. /////////////////////////////////////////////////////////////////////////////
  49. // CSampleApp initialization
  50.  
  51. BOOL CSampleApp::InitInstance()
  52. {
  53.     AfxEnableControlContainer();
  54.  
  55.     // Standard initialization
  56.     // If you are not using these features and wish to reduce the size
  57.     //  of your final executable, you should remove from the following
  58.     //  the specific initialization routines you do not need.
  59.  
  60. #ifdef _AFXDLL
  61.     Enable3dControls();            // Call this when using MFC in a shared DLL
  62. #else
  63.     Enable3dControlsStatic();    // Call this when linking to MFC statically
  64. #endif
  65.  
  66.     // Change the registry key under which our settings are stored.
  67.     // You should modify this string to be something appropriate
  68.     // such as the name of your company or organization.
  69.     SetRegistryKey(_T("Local AppWizard-Generated Applications"));
  70.  
  71.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  72.  
  73.     // register this instance of GeometryManager
  74.     //
  75.     // When you purchase a license of GeometryManager, you
  76.     // will enter the registration code string here and
  77.     // the DLL will no longer remind you to register!
  78.     //
  79.     VERIFY(GmRegister("ENTER YOUR REGISTRATION CODE HERE"));
  80.  
  81.     // Register the application's document templates.  Document templates
  82.     //  serve as the connection between documents, frame windows and views.
  83.  
  84.     CMultiDocTemplate* pDocTemplate;
  85.     pDocTemplate = new CMultiDocTemplate(
  86.         IDR_SAMPLETYPE,
  87.         RUNTIME_CLASS(CSampleDoc),
  88.         RUNTIME_CLASS(CChildFrame), // custom MDI child frame
  89.         RUNTIME_CLASS(CSampleView));
  90.     AddDocTemplate(pDocTemplate);
  91.  
  92.     // create main MDI Frame window
  93.     CMainFrame* pMainFrame = new CMainFrame;
  94.     if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
  95.         return FALSE;
  96.     m_pMainWnd = pMainFrame;
  97.  
  98.     // Parse command line for standard shell commands, DDE, file open
  99.     CCommandLineInfo cmdInfo;
  100.     ParseCommandLine(cmdInfo);
  101.  
  102.     // Dispatch commands specified on the command line
  103.     if (!ProcessShellCommand(cmdInfo))
  104.         return FALSE;
  105.  
  106.     // The main window has been initialized, so show and update it.
  107.     pMainFrame->ShowWindow(m_nCmdShow);
  108.     pMainFrame->UpdateWindow();
  109.  
  110.     return TRUE;
  111. }
  112.  
  113. /////////////////////////////////////////////////////////////////////////////
  114. // CAboutDlg dialog used for App About
  115.  
  116. class CAboutDlg : public CDialog
  117. {
  118. public:
  119.     CAboutDlg();
  120.  
  121. // Dialog Data
  122.     //{{AFX_DATA(CAboutDlg)
  123.     enum { IDD = IDD_ABOUTBOX };
  124.     //}}AFX_DATA
  125.  
  126.     // ClassWizard generated virtual function overrides
  127.     //{{AFX_VIRTUAL(CAboutDlg)
  128.     protected:
  129.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  130.     //}}AFX_VIRTUAL
  131.  
  132. // Implementation
  133. protected:
  134.     //{{AFX_MSG(CAboutDlg)
  135.         // No message handlers
  136.     //}}AFX_MSG
  137.     DECLARE_MESSAGE_MAP()
  138. };
  139.  
  140. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  141. {
  142.     //{{AFX_DATA_INIT(CAboutDlg)
  143.     //}}AFX_DATA_INIT
  144. }
  145.  
  146. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  147. {
  148.     CDialog::DoDataExchange(pDX);
  149.     //{{AFX_DATA_MAP(CAboutDlg)
  150.     //}}AFX_DATA_MAP
  151. }
  152.  
  153. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  154.     //{{AFX_MSG_MAP(CAboutDlg)
  155.         // No message handlers
  156.     //}}AFX_MSG_MAP
  157. END_MESSAGE_MAP()
  158.  
  159. // App command to run the dialog
  160. void CSampleApp::OnAppAbout()
  161. {
  162.     CAboutDlg aboutDlg;
  163.     aboutDlg.DoModal();
  164. }
  165.  
  166. /////////////////////////////////////////////////////////////////////////////
  167. // CSampleApp commands
  168.